<template>
  <el-container>
    <el-aside style="width: 200px;margin-top: 20px">
      <switch></switch>
      <SideMenu @indexSelect="getGoods" ref="sideMenu"></SideMenu>
    </el-aside>
    <el-main>
     <Goods class="goods-area"ref="Goods"></Goods>
      
    </el-main>
  </el-container>
</template>

<script>
import SideMenu from './SideMenu.vue'
import Goods from './Goods.vue'
  export default {
    name: 'GoodsIndex',
    components:{SideMenu,Goods},
    data(){
      return{
         goods:[]
      }
    },
    methods:{
      getGoods(){
        var _this=this
        this.$axios.post('/getCategoryGoods',{
          category:this.$refs.sideMenu.cid,
          state:this.$refs.sideMenu.isCollapse
        }).then(resp => {
            _this.$refs.Goods.goods = resp.data
            _this.$refs.Goods.currentPage = 1
        })
      }
    }
  }
</script>

<style scoped>

.books-area {
    width: 990px;
    margin-left: auto;
    margin-right: auto;
  }
</style>
